include Makefile-config

SUBDIRS = exporter parser rendererelements sceneelements trianglemeshreader utils
INCLUDE = -I.
LDFLAGS += $(foreach dir, $(SUBDIRS), -L$(dir))

BINS = RayTracer
OBJS = RayTracer.o Renderer.o Scene.o

.PHONY: clean tags subdirs $(SUBDIRS)

all: tags subdirs $(OBJS) $(BINS)

DEPS = ./rendererelements/Sampler/SuperSampler.o ./rendererelements/Sampler/Sample.o ./rendererelements/Integrator/WhittedIntegrator.o ./rendererelements/Integrator/Integrator.o ./rendererelements/Integrator/DirectLighting.o ./rendererelements/Integrator/PathTracer.o ./rendererelements/IntersectionData.o ./parser/SceneParser.o ./parser/ConfigParser.o ./parser/SimpleXMLNode.o ./utils/textures/ImageTexture.o ./utils/Image.o ./utils/Ray.o ./sceneelements/SimpleCamera.o ./sceneelements/geometry/MeshTriangle.o ./sceneelements/geometry/Mesh.o ./sceneelements/geometry/MeshVertex.o ./sceneelements/IElement.o ./sceneelements/PointLight.o ./Scene.o ./exporter/Exporter.o ./trianglemeshreader/OBJFileReader.o ./Renderer.o ./RayTracer.o 
RayTracer: $(DEPS)

subdirs: $(SUBDIRS)

$(SUBDIRS):
	$(MAKE) -C $@

tags:
	ctags -f ./tags -R .
clean:
	rm -rf $(OBJS) $(BINS)
	for dir in $(SUBDIRS); do \
		$(MAKE) -C $$dir clean; \
	done
